<?php

namespace App\Http\Controllers;

use Encore\Admin\Auth\Database\Administrator;
use Illuminate\Http\Request;
use App\Models\AdminRolePermissions;
use App\Models\AdminRoleUsers;
use App\Models\AdminUser;
use Illuminate\Support\Facades\Hash;

class CreatAdminUserController extends BaseController
{
    public function index()
    {
        $admin = Administrator::create([
            'username' => 'wangsan',
            'password' => Hash::make('123456'),
            'name' => '供应商',
        ]);
        $admin->roles()->attach($admin->id, ['role_id' => 2]);
        return $this->ResultJson(1, '成功', ['id' => $admin]);
    }
}
